![]() |
PATH![]() |
![]() ![]() |
You can use AppleScript's version property to check the current version of AppleScript. The following script checks for a version greater than or equal to version 1.3.4 before performing any other operations.
if (version as string) ≥ "1.3.4" then
-- Perform any operations that depend on the
-- presence of AppleScript version 1.3.4 or later.
end if
Version is a property of other applications as well as AppleScript, so to access the AppleScript version inside a Tell block to another application, you must use the phrase AppleScript's version or version of AppleScript :
tell application "AppleWorks"
version --result: "5.0v1" (version of AppleWorks)
if (AppleScript's version as string) ≥ "1.3.4" then
-- Perform any operations that depend on the
-- presence of AppleScript version 1.3.4 or later.
end if
end tell
For a description of the global variable AppleScript , see AppleScript Properties.
The following script checks for version 8.5 or later of the Finder, and puts up a warning if it isn't present (using the Display Dialog scripting addition command).
tell application "Finder"
--check to make sure System 8.5 or later is installed
set theVersion to (get the version) as number
if theVersion is less than 8.5 then
beep
display dialog ¬
"This script requires MacOS 8.5 or later." ¬
buttons {"Cancel"} default button 1 with icon 0
end if
end tell